﻿using System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

namespace Jy123.Web.Module.Club
{
    public class CreateModule1 : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string userIdString = context.Request.Form["idHidden"];
            if (!string.IsNullOrEmpty(userIdString))
            {
                int userId = int.Parse(userIdString);
                string strJType = context.Request.Form["mitem"].ToString();
                int JTypeId = int.Parse(strJType);
                Jy123.BLL.User_Main BLLUser = new Jy123.BLL.User_Main();
                Jy123.Model.User_Main user = BLLUser.GetModel(userId);
                Jy123.BLL.Public_JType BLLJType = new Jy123.BLL.Public_JType();
                Jy123.Model.Public_JType JType = BLLJType.GetModel(JTypeId);
                string strName = context.Request.Form["moduleName"];
                if (string.IsNullOrEmpty(strName))
                {
                    strName = user.UserName + "的" + JType.JName;
                }
                string strDes = context.Request.Form["description"];
                Jy123.BLL.Module.Module BLLMModule = new Jy123.BLL.Module.Module();
                string strRedirect = BLLMModule.CreateModule(JType, userId, strName, strDes);
                context.Response.Redirect(strRedirect);
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
